< Prev(J) / Next(K) > / View :

Filename: /text/sbasic/shared/03020303.xhp

(section: lof) (bookmark: bm_id3156024)
Lof function

Lof 関数

Lof Function [Runtime]
Lof 関数 [実行時](hd_id3156024.1)

Returns the size of an open file in bytes.
オープン済みファイルのサイズを、バイト単位で返します。(par_id3146794.2)

(/section: lof)

Syntax:
構文:(hd_id3153380.3)

Lof (FileNumber)
Lof (FileNumber)(par_id3150359.4)

Return value:
戻り値:(hd_id3154141.5)

Long
ロング整数(par_id3147230.6)

Parameters:
パラメータ:(hd_id3156281.7)

FileNumber: Any numeric expression that contains the file number that is specified in the Open statement.
FileNumber: Open ステートメントが割り当てたファイル番号を示す数値表式。(par_id3150869.8)

Tip Icon ヒント To obtain the length of a file that is not open, use the FileLen function.
オープンされていないファイルのサイズを取得する場合は、FileLen 関数を使用する必要があります。(par_id3147349.9)

(embed text/sbasic/shared/00000003.xhp#errorcode : linkinfo)

Error Codes

エラーコード(hd_id3152869.37)

(/embed text/sbasic/shared/00000003.xhp#errorcode)

(embed text/sbasic/shared/00000003.xhp#err5 : linkinfo)

5 Invalid procedure call
5 無効なプロシージャー呼び出しです (par_id3150891.41)

(/embed text/sbasic/shared/00000003.xhp#err5)

(embed text/sbasic/shared/00000003.xhp#err52 : linkinfo)

52 Bad file name or number
52 ファイル名または番号が不正です(par_id3154404.58)

(/embed text/sbasic/shared/00000003.xhp#err52)

Example:
例:(hd_id3155415.10)

Sub ExampleRandomAccess
Sub ExampleRandomAccess(par_id3151074.11)

Dim iNumber As Integer
Dim iNumber As Integer(par_id3145251.12)

Dim sText As Variant REM must be a Variant
Dim sText As Variant REM バリアント型変数が必要(par_id3154730.13)

Dim aFile As String
Dim aFile As String(par_id3145646.14)

aFile = "c:\data.txt"
aFile = "c:\data.txt"(par_id3153157.15)

iNumber = Freefile
iNumber = Freefile(par_id3149403.17)

Open aFile For Random As #iNumber Len=32
Open aFile For Random As #iNumber Len=32(par_id3149121.18)

Seek #iNumber,1 REM Position at start
Seek #iNumber,1 REM 開始位置(par_id3156276.19)

Put #iNumber,, "This is the first line of text" REM Fill with text
Put #iNumber,, "This is the first line of text" REM テキストの書き込み(par_id3148405.20)

Put #iNumber,, "This is the second line of text"
Put #iNumber,, "This is the second line of text"(par_id3154756.21)

Put #iNumber,, "This is the third line of text"
Put #iNumber,, "This is the third line of text"(par_id3145643.22)

Seek #iNumber,2
Seek #iNumber,2(par_id3156383.23)

Get #iNumber,,sText
Get #iNumber,,sText(par_id3155333.24)

Print sText
Print sText(par_id3149255.25)

Close #iNumber
Close #iNumber(par_id3154702.26)

iNumber = Freefile
iNumber = Freefile(par_id3153965.28)

Open aFile For Random As #iNumber Len=32
Open aFile For Random As #iNumber Len=32(par_id3163807.29)

Get #iNumber,2,sText
Get #iNumber,2,sText(par_id3155607.30)

Put #iNumber,,"This is a new line of text"
Put #iNumber,,"This is a new line of text"(par_id3150299.31)

Get #iNumber,1,sText
Get #iNumber,1,sText(par_id3147002.32)

Get #iNumber,2,sText
Get #iNumber,2,sText(par_id3149036.33)

Put #iNumber,20,"This is the text in record 20"
Put #iNumber,20,"This is the text in record 20"(par_id3166425.34)

Print Lof(#iNumber)
Print Lof(#iNumber)(par_id3149817.35)

Close #iNumber
Close #iNumber(par_id3146811.36)

end sub
end sub(par_id3154200.38)


< Prev / Next >